<template>
	<view class="custom--model">
		<!-- 自定义模态框-->
		<u-overlay :show="show" opacity="0.6">
			<view class="warp">
				<view class="po-re" :style="{top:top}" 
					style="padding:0 30rpx;width:600rpx ;box-sizing:border-box;min-height:250rpx;border-radius: 16rpx;background-color: #ffffff;overflow: hidden;">
					<!-- 标题 -->
						<view class="d-flex flex-c ali-i-c just-c b-box" v-if="title" style="margin: 52rpx 0;">
							<view class=" d-flex flex-r ali-i-c just-c po-re" style="margin-bottom: 20rpx;">
								<image v-if="success" :src="require('../../static/success_pic.png')" style="width: 162rpx;height:162rpx"></image>
								<image v-else-if="!success" :src="require('../../static/danger.png')" style="width: 162rpx;height:162rpx"></image>
							</view>
							<text style="font: 500 34rpx PingFang SC;color: #000000;margin-left: 20rpx;">{{title}}</text>
						</view>
					<!-- 按钮 -->
					<view style="width: 100%;padding-bottom: 48rpx;" class="d-flex flex-r ali-i-c just-sw b-box">
						<!-- 取消 -->
						<view v-if="cancelText"
							class="d-flex flex-r ali-i-c just-c" @click="cancel"
							style="width: 260rpx;height:60rpx;border: 2rpx solid #DDDDDD;border-radius: 30rpx;">
							<text style="font:400 28rpx PingFang SC;color:#333333">{{cancelText}}</text>
						</view>
						<!-- 确定 -->
						<view  v-if="confirmText"
							class="d-flex flex-r ali-i-c just-c" @click="confirm"
							style="width: 260rpx;height:60rpx;border: 1rpx solid #26387C; background: #ffffff;border-radius: 30rpx;">
							<text style="font:400 28rpx PingFang SC;color:#26387C;">{{confirmText}}</text>
						</view>
					</view>
				</view>
			</view>

		</u-overlay>
	</view>
</template>

<script>
	export default {
		name: "custom-model",
		props:{
			top:{
				type:String,
				default:'0rpx'
			},
			title:{
				type:String,
				default:''
			},
			show:{
				type:Boolean,
				default:false
			},
			confirmText:{
				type:String,
				default:'确定'
			},
			cancelText:{
				type:String,
				default:'取消'
			},
			success:{
				type:Boolean,
				default:true
			}
		},
		data() {
			return {
				
			};
		},
		methods: {
			confirm(){
				this.$emit('confirm',1)
				
			},
			cancel(){
				this.$emit('cancel',0)
				
			}
		}
	}
</script>

<style lang="scss">
	.custom--model {
		.warp {
			display: flex;
			align-items: center;
			justify-content: center;
			flex-direction: row;
			height: 100%;
		}
			
		
	}
</style>
